package wrs.hcs.tc;

import org.openqa.selenium.WebDriver;
import wrs.hcs.functions.*;

public class WebApp_OutPatientPIN {

	public static WebDriver driver;
	public static String lName;
	public static String pin;
	
	public void transact() throws Exception
	{
		Webdriver d = new Webdriver();
		Login log = new Login();
		Logout out = new Logout();

		driver = d.startUp();
			
		Hcs_NewPatient newPatient = new Hcs_NewPatient();
		log.hcs(driver, "admission"); 								//login
		
		//Criteria for login in hcs: "admission", "nursing", "billing"
		
		String getIt = newPatient.createPatient(driver, "adult");			//new patient in hcs
		out.hcs(driver); 											//logout after getting pin and lastname
		
		
		//Split string for PIN and LASTNAME
		String[] arrString = getIt.split(",");
		lName = arrString[0];
		pin = arrString[1];
		
		WebApp_Outpatient o = new WebApp_Outpatient();
		o.wellness(driver, lName, pin, false); 						//create wrs transaction in webapp for patient
		
		driver = d.startUp();
		log.admin(driver); //login
		AdminConsole_Single console = new AdminConsole_Single();
		console.admin(driver, pin, "outpatient");   				//update on admin and forward to hcs
		out.admin(driver);
		
		log.hcs(driver, "admission");
		Hcs_Admission admin = new Hcs_Admission();
		admin.admin(driver, pin);
		driver.quit();
		
	}
	
}
